Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1075 +/- ##
==========================================
+ Coverage 91.93% 91.95% +0.01%
==========================================
Files 51 51
Lines 7664 7715 +51
==========================================
+ Hits 7046 7094 +48
- Misses 618 621 +3
🚀 New features to boost your workflow:
|
|
I've done a similar PR in |
4dfd03f to
ce54b02
Compare
| [tool.ruff.lint.isort] | ||
| required-imports = ["from __future__ import annotations"] |
There was a problem hiding this comment.
I added this. It makes it so the UP lints will always flag when you’re just using an import in an annotation, and therefore will automatically skip such imports at runtime by sticking them into if TYPE_CHECKING: blocks.
There was a problem hiding this comment.
Looks good!
In case you want to do everything we do in scanpy, we also do this to enforce that a list of slow-to-import packages aren’t accidentally imported:
- define a pytest plugin that isn’t part of the scanpy module (
testing.scanpy._pytestor aconftest.pyin the repository root both work, the former has to be activated usingtool.pytest.addopts = ["-p", "testing.scanpy._pytest"]) - import
scanpyin there and recordsys.modulesbefore and after - check the diff against the list of to-be-lazy-loaded modules.
unfortunately that approach means we can’t use our own warnings in the tool.pytest.filterwarnings setting, but I can’t think of another way to do it except for importing it in a subprocess.
Gives a shot at #456. I'll close it, but in the future we could explore further optimizations (see the
profimpreport below).@ivirshup @flying-sheep I'll tag you as reviewers since you did similar work in scverse/scanpy#756.
This PR:
spatialdataand submodules lazyasvbenchmarkperfimpto the dev requirementsResults:
Output from
profimpCommand

profimp "from spatialdata import read_zarr" --html > profimp.html && open profimp.html